Search the Community
Showing results for tags 'command line parameters'.
-
Recently, I was getting bored because of quarantine. So I thought maybe let's do some AutoIt. I recently discovered that you can use the command prompt to run autoit scripts with CmdLine, so I was excited to use it for the first time. I wanted to make a program which "creates" a 2nd clipboard. So this is how it should work. - I open cmd - I type in "filename.au3 [the words that i want to copy]" - I press enter - It creates a hotkey to paste the copied word - It does an empty while loop so it doesn't immediately exit - To exit the script, I type in "filename.au3 exit". But "filename.au3 exit" doesn't work so I have to manually click on the tray icon which is not what I wanted. I'm fairly new to AutoIt so I don't really know how things work. Sorry if my English is horrible, it isn't my native language. Any help would be greatly appreciated. Global Const $g_iProfileDir = @UserProfileDir & "\" Global Const $g_iProgDir = @UserProfileDir & "\Clipify 2.0\" ;dir path Global Const $g_iIniFile = $g_iProgDir & "config.ini" ;ini file path DirCreate($g_iProgDir) Local $iIniRead = IniRead($g_iIniFile, "Setup", "IfExists", "NOEXIST") ; checks if the ini file exists If $iIniRead = "NOEXIST" Then IniWrite($g_iIniFile, "Setup", "IfExists", "1") FileMove(@ScriptFullPath, $g_iProfileDir & @ScriptName) ; if it doesn't exist, it'll create the ini file and move the script to the user directory so you don't have to put the entire file path Else Select Case $CmdLine[0] = "" ToolTip("") Case $CmdLine[1] <> "Exit" HotKeySet("{TAB}", "_Clip2") HotKeySet("`", "_Exit") While 1 WEnd Case $CmdLine[1] = "Exit" Local $aProcessList = ProcessList(@AutoItPID) For $i = 1 To $aProcessList[0][0] ProcessClose($aProcessList[$i][1]) Next Case Else ; if it has more than 2 parameters it will automatically exit Exit EndSelect EndIf Func _Clip2() Send($CmdLine[1]) EndFunc ;==>_Clip2 Func _Exit() Exit EndFunc ;==>_Exit
-
Is there a way to simualte command line parameters instead of having to: Compile the script. Enter Windows' DOS prompt and run the script with paramerers and/or create a shortcut.every time you want to run the script (if it can't run without parameters)? $cmdlineraw can be re-assigned but it doesn't affect $cmdline, which is a non editable constant. Is there any way around it? Thanks!