Limiting program instances or processes, Unrealted to FOG, but still imaging Related
-
…But like junkhacker said - this probably won’t work or you might run into trouble for chrome as there is more than one process for a single instance and if chrome doesn’t close successfully you’d have to physically kill it for you to be able to run this code again? you could get it ask user if they want to close previous instance if it exists to give you complete control?
if so, look at InputBox function
one last thing - if you’re just starting out with autoit install [SIZE=13px][FONT=Open Sans][COLOR=#1c1c1c]SciTE … Syntaxcheck prod and tidy autoit source will help a bundle (Tools->SyntaxCheckProd or Tools->Tidy Autoit Source)[/COLOR][/FONT][/SIZE]
[url]https://www.autoitscript.com/site/autoit-script-editor/downloads/[/url]
-
Thank for your input, you’re right I can slim it down to
[quote=“Lee Rowlett, post: 41539, member: 28”]
[CODE]#NoTrayIcon
#include <Misc.au3>
#include <MsgBoxConstants.au3>If ProcessExists(“chrome.exe”) Then
MsgBox(64, “Warning”, “Only one instance is allowed”)
Else
ShellExecuteWait(@ProgramFilesDir & “\Google\Chrome\Application\chrome.exe”)
EndIf[/CODE]should get same results.
p.s. i hadn’t actually ever tried the _Singleton funcion… glad to know it DOESNT work lol![/quote]Without much of an issue. I had a recommendation to use a while loop to help accommodate that singleton function, then I moved awya from singelton to the ProcessExists. This week I have some more time to play around with it a bit.
I plan to actually change chrome.exe to something garbled such as qweljklewr and drop off the extension, I’m going to see if I can’t get the script to copy the file and rename it to something.exe an run it from there. Chrome only likes to work if it’s in the correct directory, but if I leave it a .exe the students will find it, this could help deter them from finding my file.
I’ll keep playing with it. Right now it doesn’t seem like many are interested in limiting chrome, this could be beneficial to someone in the future!
-
This seems to work nicely.
[code]
#NoTrayIcon
#include <Misc.au3>
#include <MsgBoxConstants.au3>
$str = “.exe”If ProcessExists(“chrome.exe”) Then
MsgBox(64, “Warning”, “Only one instance is allowed”)
Else
FileMove(@ProgramFilesDir & “\Google\Chrome\Application\asdfghjkl”, @ProgramFilesDir & “\Google\Chrome\Application\asdfghjkl” & $str)
ShellExecuteWait(@ProgramFilesDir & “\Google\Chrome\Application\asdfghjkl.exe”)
FileMove(@ProgramFilesDir & “\Google\Chrome\Application\asdfghjkl.exe”, @ProgramFilesDir & “\Google\Chrome\Application\asdfghjkl”)
EndIf
[/code]Still tweaking, I am thinking about hosting my main chrome.exe file outside of the google folders to help prevent users from stumbling upon the file!
-
do your students have admin rights on these devices?
[url]http://www.askvg.com/the-best-method-to-hide-files-folders-in-windows-without-using-3rd-party-utilities/[/url]warning you will have issues with regedit until you renable it in your gpo. If you wish to edit the registry after imaging.
-
[quote=“Wolfbane8653, post: 41566, member: 3362”]do your students have admin rights on these devices?
[url]http://www.askvg.com/the-best-method-to-hide-files-folders-in-windows-without-using-3rd-party-utilities/[/url]warning you will have issues with regedit until you renable it in your gpo. If you wish to edit the registry after imaging.[/quote]
Yes all basic users that are logged in are admins.
I almost had a variant working that launched files without extensions, I still need to tweak it a bit.
-
don’t forget that those students can always right click and “open file location” for shortcuts
[url]http://www.sevenforums.com/tutorials/236988-open-file-location-add-remove-context-menu.html[/url]
-
even more robust use FileInstall… that way you don’t have to have it anywhere on the machine, won’t be there unless executed so will give less chance of users finding it ;-)… also means they cannot delete it ;-).
it will embed into the .exe and will extract when executed and once you’re done just delete so… it also means you don’t rely on the file being in a certain location (so if deleted, don’t matter just put it back next time it runs :-D). only few limitations - is you have to make sure you’re .exe source is in the location you specify when compiling and the source cannot contain variables and if it’s a “large” file you’re embedding it’s slugish/freezes part from that all good!
change First Filemove to:
FileInstall([FONT=Consolas]“C:\Temp\MyScript\asdfghjkl.exe”, @ProgramFilesDir & “\Google\Chrome\Application\asdfghjkl.exe”, 1)[/FONT]
2nd Filemove to:
FileDelete([FONT=Consolas]@ProgramFilesDir & “\Google\Chrome\Application\asdfghjkl.exe”)[/FONT]
-
[quote=“Wolfbane8653, post: 41570, member: 3362”]don’t forget that those students can always right click and “open file location” for shortcuts
don’t do it as a shortcut… have it as an .exe within an .exe so .exe on desktop extract the .exe into chrome folder and executes it, waits for it to finish and then deletes.
-
[quote=“Lee Rowlett, post: 41572, member: 28”]don’t do it as a shortcut… have it as an .exe within an .exe so .exe on desktop extract the .exe into chrome folder and executes it, waits for it to finish and then deletes.[/quote]
I won’t use a shortcut, I can’t trust these kids, I almost ran chrome in kiosk mode but decided it wasn’t worth my effort, at least with AutoIT they think it is chrome.exe and they aren’t any wiser.
I was not able to use your FileInstall recommendation, for some reason after I compile it and run the .exe, it claims the program is already running, when it is not. It only, renames the file or moves it when I run the .a3u and not the .exe.
-
I think this is the code I am going to use.
[code]
#NoTrayIcon
#include <Misc.au3>
#include <MsgBoxConstants.au3>Opt(“RunErrorsFatal”, 0)
While 1
If ProcessExists(“asdfghjkl”) Then
MsgBox(64, “Warning”, “Please close the current window before opening another!”)
Exit
Else
Run(@ProgramFilesDir & “\Google\Chrome\Application\asdfghjkl”, “”, @SW_HIDE)
If Not @error Then Exit
EndIf
WEnd
[/code]This seems to work well, I have renamed chrome.exe to asdfghjkl and with the script I am able to execute the file. I compile my script as chrome.exe with the chrome Icon.
-
Wanted to add that my chrome script is working flawlessly.
Something I forgot to take into consideration was the hotkeys chrome uses.
Users can still launch an incognitio window with Ctrl+Shift+N and they can launch a new window with Ctrl+N.
I wrote another script for Auto IT that will block these key commands.
Does anyone know how to limit the blocking to the Chrome sessions only?
Until then I am going to leave the Alt+F4 key alone, it is still useful in other cases.
[code]
#NoTrayIcon
HotKeySet(“^n”, “_SarlaccPit”)
HotKeySet(“^N”, “_SarlaccPit”)
HotKeySet(“^t”, “_SarlaccPit”)
;HotKeySet(“!{F4}”, “_SarlaccPit”)While 1
Sleep(500)
WEndFunc _SarlaccPit()
EndFunc[/code]
Right now I compiled this as an exe and it runs at startup
-
[quote=“Jaymes Driver, post: 41468, member: 3582”]Here I am again, with another one of those OFF THE WALL ideas. I will explain my situation again so incase someone who is not familiar with my set up understands what I am trying to accomplish.
[B]Platform:[/B]
Windows 7 32 bit[B]End goal:[/B]
What I want to do, is limit the amount of times a program can be opened, so it can only be opened once and can not be opened until your current window is closed. Particularly, I am aiming to lock down Chrome. Chrome has this weird habit of letting you use an extension to limit the amount of tabs a browsing session can have, but then you can open 20 different chrome windows and circumvent the tab limitation (each window will be locked to 3 tabs but I want only 3 tabs EVER and only one window EVER.)Is there a way to limit a program process to run only a limited number of times?
[B]The reason:[/B]
I work k-12 and my high school students that have an online learning alternative have found a way to circumvent the system by using a browser session to log into the course material and use another browser session to complete the test material while using the course material to answer the questions.I used FireFox and it worked well, to limit the number of windows open to only 1 and I limit them to 3 tabs. This works except the service I use doesn’t support FireFox completely, some of the material doesn’t display properly or entirely and the “continue” or “next” button seems to be missing in the material. Granted I have reached out to the company many times to complain of the issues, but they only seem to contact me back after Firefox puts out an update, and they want me to update firefox to see if the issue is still there… Uhh yeah, if you didn’t fix it, it still exists! They also have no intentions of only allowing a single sign on instance to the material.
So inventive ideas are welcome!
[B]Current Measures:[/B]
I have already locked down Internet explorer by replacing it with a lock down browser, but this prevents the users from being able to access the calculator, or the music app, or the word processor, it also takes some special steps to stop the process, we only use this in the worse case scenarios where we really can’t keep the student on task.I have ran chrome in Kiosk mode, but this eliminates the ability to use the browser in it’s normal function and works in full screen mode only. The only way to leave chrome kiosk is to use alt+F4, and you can not access the tabs or the url bar while in Kiosk mode.
As you can see, I am up against a wall, and any ideas you have that can help me to achieve my goal would be greatly appreciated.[/quote]
In my honest opinion, you are doing too much. This is a classroom management issue, not a technology issue. If some students are repetitively academically dishonest while using technology, suspend their technology privileges, let them take a paper test instead.
-
[quote=“Wayne Workman, post: 43359, member: 28155”]In my honest opinion, you are doing too much. This is a classroom management issue, not a technology issue. If some students are repetitively academically dishonest while using technology, suspend their technology privileges, let them take a paper test instead.[/quote]
Agreed, but some administrations see that using the shot gun approach to issues is the best. The only way for this approach to work is to limit the technology itself. So Jaymes is making the best out of his situation.
Students pop the keys off of keyboards here all the time. We all know its a classroom management issue but no one does anything, so I’m stuck fixing keys all the time. I do have to hand it to them they did have enough time to spell out “F*** YOU” on the finger placement keys. (Yes they stole the second “U” off another keyboard.) Just something I have to deal with I guess.
-
[quote=“Wayne Workman, post: 43359, member: 28155”]In my honest opinion, you are doing too much. This is a classroom management issue, not a technology issue. If some students are repetitively academically dishonest while using technology, suspend their technology privileges, let them take a paper test instead.[/quote]
I agree Wayne, but I am a technology support person and I do not administer the class room. I can make suggestions left and right, but that does not mean that the administrators will follow my suggestions.
This was also more or less a personal quest, after having so much difficulty in preventing the extra windows, it has become a vendetta lol.
[quote=“Wolfbane8653, post: 43362, member: 3362”]Agreed, but some administrations see that using the shot gun approach to issues is the best. The only way for this approach to work is to limit the technology itself. So Jaymes is making the best out of his situation.
Students pop the keys off of keyboards here all the time. We all know its a classroom management issue but no one does anything, so I’m stuck fixing keys all the time. I do have to hand it to them they did have enough time to spell out “F*** YOU” on the finger placement keys. (Yes they stole the second “U” off another keyboard.) Just something I have to deal with I guess.[/quote]
Thanks for your vote of support and understanding. However, I have found that even after all of my attempts to stop chrome from opening more than once, have failed. My AutoIT program works flawlessly. It won’t allow more than one window of chrome to open, so long as it is what is used to start chrome.
If chrome is already open, you can still click the “open new window” and it will start a new session, the same thing occurs for “New Incognito Window”.
As much as I wanted to solve this issue, I think it is out of my control now. I’ve done everything to block new windows, or attempt to, and to prevent incognito windows, even with reg hacks to prevent incognito, they still start when you click the button. The only thing left to do would be to build a browser… and I am not going that far.
I am going to look into the chrome for education and business lines see if I can find a way to manage sessions and settings via an admin panel.
-
I have successfully disabled the incognito on the machines here using this reg hack.[URL=‘https://www.internetsafetyproject.org/wiki/how-disable-incognito-mode-chrome’]
https://www.internetsafetyproject.org/wiki/how-disable-incognito-mode-chrome[/URL]new windows however are hard.
-
[quote=“Wolfbane8653, post: 43365, member: 3362”]I have successfully disabled the incognito on the machines here using this reg hack.
[url]https://www.internetsafetyproject.org/wiki/how-disable-incognito-mode-chrome[/url]new windows however are hard.[/quote]
It says that after applying the reg hack the option in the menu will not be available… Its still there!!!
-
It being there, or not, does it open an incognito window?
-
[quote=“Tom Elliott, post: 43373, member: 7271”]It being there, or not, does it open an incognito window?[/quote]
Yes, incognito window still starts unfortunately
However, I am not sure how reputable this program is, but I found something called “Incognito Gone” and it seems to work well… Now to squash the New window button and this could be golden.
What would be nice is if the service limited logins to a single sign on
-
[quote=“Wolfbane8653, post: 43362, member: 3362”]Agreed, but some administrations see that using the shot gun approach to issues is the best. The only way for this approach to work is to limit the technology itself. So Jaymes is making the best out of his situation.
Students pop the keys off of keyboards here all the time. We all know its a classroom management issue but no one does anything, so I’m stuck fixing keys all the time. I do have to hand it to them they did have enough time to spell out “F*** YOU” on the finger placement keys. (Yes they stole the second “U” off another keyboard.) Just something I have to deal with I guess.[/quote]
One time, I found a keyboard with all the keys arranged in alphabetical order. You know that took a while… Again, a classroom management problem. How can a teacher not notice a kid plucking keys off all hour long? Only if they aren’t being active in the computer lab, only if they aren’t walking around and keeping an eye on things.
-
[quote=“Wayne Workman, post: 43376, member: 28155”]One time, I found a keyboard with all the keys arranged in alphabetical order. You know that took a while… Again, a classroom management problem. How can a teacher not notice a kid plucking keys off all hour long? Only if they aren’t being active in the computer lab, only if they aren’t walking around and keeping an eye on things.[/quote]
I understand your stance. Unfortunately the corporation I work in has little to no accountability, and no one ever gets reprimanded. Even the students who have been showing the others how to cheat get off scott free.
I would like to see better classroom management, but unfortunately, I can’t
These are students that the school corporation has more or less “given up on” and have been sent to an alternative learning center. While the instructors may have given up on the students, I have not.