AlexGo Posted March 30, 2019 Share Posted March 30, 2019 Hello everybody, I will my script from USB Stick starten and after start unplugging the stick. If I do this, then script looks running but didn't work. If I plug the Stick again - then work script well. Can I make the script work work in such conditions? Thanks a lot! Link to comment Share on other sites More sharing options...
Deye Posted March 30, 2019 Share Posted March 30, 2019 (edited) AlexGo, first tell us What resources or macro's like @scriptDir does the script use Or post it .. Deye Edited March 30, 2019 by Deye Link to comment Share on other sites More sharing options...
AlexGo Posted March 30, 2019 Author Share Posted March 30, 2019 @Deye Hi, actually it's much macros's ... Script looks so: HotKeySet("+d", "DeInstallIPOS") InstallIPOS() While 1 Sleep(100) WEnd Func InstallIPOS() Run("ipos.exe") WinWaitActive("Setup - IPOS") Send("{ENTER}") WinWaitActive("Setup - IPOS", "Beenden des IPOS Setup-Assistenten") Send("{ENTER}") EndFunc Func DeInstallIPOS () Run("C:\Windows\SysWOW64\ipos\unins000.exe") Send("{ENTER}") WinWait("IPOS entfernen", "Sind Sie sicher, dass Sie IPOS und alle zugehörigen Komponenten entfernen möchten?") Send("{LEFT}") Send("{ENTER}") WinWait("IPOS entfernen", "Um die Deinstallation von IPOS abzuschließen, muss Ihr Computer neu gestartet werden.") Send("{RIGHT}") Send("{ENTER}") Run(@ComSpec & " /c " & 'shutdown -s -t 0', "", @SW_HIDE) EndFunc Link to comment Share on other sites More sharing options...
Aelc Posted March 31, 2019 Share Posted March 31, 2019 hey i'm a bit confused so you wanna 1. plug the stick, then the installer starts, you drop the stick 2. plug the stick, then DEinstaller starts, you drop the stick? or you just wanna copy ur script and when the stick gets plugged it shall start de/install? grüße ✌️ why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
AlexGo Posted March 31, 2019 Author Share Posted March 31, 2019 @Aelc Hi Aelc, no no no Stick in -> run script - programm install - hot key "shift + d" for uninstall -> stick out -> if "shift + d" pressed - uninstall and shutdown Problem - without stick hot keys didnt work. HotKeySet("+d", "DeInstallIPOS") ; set "shift + d" for uninstall InstallIPOS() ; install program IPOS.exe While 1 ; waiting for hot key Sleep(100) WEnd Func InstallIPOS() ; function for install IPOS.exe Run("ipos.exe") WinWaitActive("Setup - IPOS") Send("{ENTER}") WinWaitActive("Setup - IPOS", "Beenden des IPOS Setup-Assistenten") Send("{ENTER}") EndFunc Func DeInstallIPOS () ; funktion for uninstall -> started if SHIFT+d pressed (didnt work if stick unplugged) Run("C:\Windows\SysWOW64\ipos\unins000.exe") Send("{ENTER}") WinWait("IPOS entfernen", "Sind Sie sicher, dass Sie IPOS und alle zugehörigen Komponenten entfernen möchten?") Send("{LEFT}") Send("{ENTER}") WinWait("IPOS entfernen", "Um die Deinstallation von IPOS abzuschließen, muss Ihr Computer neu gestartet werden.") Send("{RIGHT}") Send("{ENTER}") Run(@ComSpec & " /c " & 'shutdown -s -t 0', "", @SW_HIDE) EndFunc Liebe Grüße Link to comment Share on other sites More sharing options...
Developers Jos Posted March 31, 2019 Developers Share Posted March 31, 2019 Add some error checking for Run() as my guess is that the scripts runs fine when the USB stick is pulled up until you do the RUN() command as the WorkDir is invalid at tht point since that will still point to the USB stick drive. So play with that a little and see if that solves it. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AlexGo Posted March 31, 2019 Author Share Posted March 31, 2019 @Jos Yeah!!! Thanks Jos!!! didn't work: HotKeySet("+d", "DeInstallIPOS") InstallIPOS() While 1 Sleep(100) WEnd Func InstallIPOS() MsgBox(0,"", "Installed") EndFunc Func DeInstallIPOS () MsgBox(0, "", "Uninstalled") Run("C:\Program Files\7-Zip\7zFM.exe") ; wrong EndFunc work: HotKeySet("+d", "DeInstallIPOS") InstallIPOS() While 1 Sleep(100) WEnd Func InstallIPOS() MsgBox(0,"", "Installed") EndFunc Func DeInstallIPOS () MsgBox(0, "", "Uninstalled") Run("C:\Program Files\7-Zip\7zFM.exe", "C:\") ; right - "C:\" is "workingdir" EndFunc im happy Link to comment Share on other sites More sharing options...
AlexGo Posted March 31, 2019 Author Share Posted March 31, 2019 much better: FileChangeDir ("C:\") for all macros Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now