ussr Posted June 30, 2011 Share Posted June 30, 2011 HI I would like to create a basic launcher script . THE IDEA: FileOpenDialog write the chosen application direction into the ini file. It will launch and close the (program)according to the starting hour/ min - and ending min/hour ,if the calendar year/month/day is true. This script is not ready yet. Timer is working. I made some loop mistakes and something else too. Im confused. Im sticking on It days ago. Please have a look.launcher.au3 Link to comment Share on other sites More sharing options...
ussr Posted July 2, 2011 Author Share Posted July 2, 2011 Thanks Guys Link to comment Share on other sites More sharing options...
martin Posted July 2, 2011 Share Posted July 2, 2011 Thanks GuysNo prob. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
monoscout999 Posted July 2, 2011 Share Posted July 2, 2011 (edited) please next time, can you use the autoit tags for showing us the script? i feel more confortable reading that way, also you can tidy your script. SciTe ---> Tools ---> Tidy AutoIt Source. I don`t undertand your problem. can you be more specific? EDIT: 147 lines is too much for a script that i don`t understand, be more specific. Edited July 2, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
Maffe811 Posted July 2, 2011 Share Posted July 2, 2011 (edited) Thanks GuysNo need to be rude.A little:"Any help" would work fine aswell. Edited July 2, 2011 by Maffe811 [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
Maffe811 Posted July 2, 2011 Share Posted July 2, 2011 Also.... What does '.ini' means ? Example: $min = IniRead('.ini', 'section', '1', '') $hour = IniRead('.ini', 'section', '2', '') $calendar = IniRead('.ini', 'section', 'calendar', '') $open = IniRead('\.ini', 'section', 'open', '') Are you trying to read a nameless ini file? and why the back slash on the last one ? [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
ussr Posted July 2, 2011 Author Share Posted July 2, 2011 IniWrite(@ScriptDir & '\.ini', 'section', '2'... and IniRead('.ini' it is possible to read ini file. I have just one in the folder. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 2, 2011 Developers Share Posted July 2, 2011 Just an extension ".ini" without a filename in front of it? 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...
ussr Posted July 2, 2011 Author Share Posted July 2, 2011 Ini part is not a problem we can call It anyhow . Link to comment Share on other sites More sharing options...
ussr Posted July 2, 2011 Author Share Posted July 2, 2011 The main problem is the loop between the buttons . I cant fix It. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 2, 2011 Developers Share Posted July 2, 2011 (edited) No idea what it all is supposed to do but thess lines do not look right: Run('$list[1][1]') If ProcessExists('$list[1][1]') Then They are literal strings and not the Array variable that is referred too. Futher: the script you attached contains a load of errors so you really need to get yourself the full installer of SciTE4AutoIt3 and use that to run the script so au3check is also ran. Edited July 2, 2011 by 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...
ussr Posted July 2, 2011 Author Share Posted July 2, 2011 After I post the script I realised that this is really bad idea. just try Run notepad.exe The FileOpenDialog button save the directory of application to ini and I dont know how to refer It. If I open different application after each other. Link to comment Share on other sites More sharing options...
ussr Posted July 2, 2011 Author Share Posted July 2, 2011 Thank you Jos now I can see my errors. Link to comment Share on other sites More sharing options...
ussr Posted July 2, 2011 Author Share Posted July 2, 2011 OK I fixed the errors.No error.Thank you Jos. But I still have loop problem. When I click file open the time section is not working. And I have no idea how to read ini @YEAR, @MON, @MDAY. This is not working $calendar = IniRead('A.ini', 'section', 'calendar', '') Please help me. For you Guys just 1 sec for me 1 week to find the solution.launcher.au3 Link to comment Share on other sites More sharing options...
monoscout999 Posted July 2, 2011 Share Posted July 2, 2011 (edited) this is much easier to read. expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiButton.au3> #include <Array.au3> #include <GuiMonthCal.au3> #include <DateTimeConstants.au3> #include <GuiImageList.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $min, $hour, $mins, $hours, $Button1, $Button3, $MonthCal1, $path_source, $PageControl1, $TabSheet1, $TabSheet2, $TabSheet3, $msg, $list, $calendar, $open, $file, $iconfile_to_use, $array, $name, $newname, $hImage _Main() Func _Main() Local $Combo1, $Combo2, $Combo3, $Combo4 GUICreate('Basic launcher', 515, 275, 211, 148) $PageControl1 = GUICtrlCreateTab(96, 8, 417, 265) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $Button1 = GUICtrlCreateButton('Go', 16, 112, 75, 25, $WS_GROUP) $TabSheet3 = GUICtrlCreateTabItem("fileopen") $path_source = GUICtrlCreateInput("", 152, 143, 197, 21) $Button3 = GUICtrlCreateButton("", 209, 102, 85, 35, $WS_GROUP) $TabSheet2 = GUICtrlCreateTabItem("timer") $Combo1 = GUICtrlCreateCombo('starting min', 136, 184, 145, 25) GUICtrlSetData(-1, '1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59') $Combo2 = GUICtrlCreateCombo('starting hour', 136, 72, 145, 25) GUICtrlSetData(-1, '01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24') $Combo3 = GUICtrlCreateCombo('ending min', 320, 184, 145, 25) GUICtrlSetData(-1, '1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59') $Combo4 = GUICtrlCreateCombo('ending hour', 320, 72, 145, 25) GUICtrlSetData(-1, '01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24') $TabSheet1 = GUICtrlCreateTabItem("calendar") GUICtrlSetState(-1, $GUI_SHOW) $MonthCal1 = GUICtrlCreateMonthCal("", 176, 48, 271, 186) _GUICtrlMonthCal_SetToday($MonthCal1, @YEAR, @MON, @MDAY) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE MsgBox(0, "", "end") Exit Case $Combo1;Min IniWrite(@ScriptDir & '\A.ini', 'section', '1', GUICtrlRead($Combo1)) ConsoleWrite(GUICtrlRead($Combo1) & @CRLF) Case $Combo2;Hour IniWrite(@ScriptDir & '\A.ini', 'section', '2', GUICtrlRead($Combo2)) ConsoleWrite(GUICtrlRead($Combo2) & @CRLF) Case $Combo3;Min IniWrite(@ScriptDir & '\A.ini', 'section', '3', GUICtrlRead($Combo3)) ConsoleWrite(GUICtrlRead($Combo3) & @CRLF) Case $Combo4;Hour IniWrite(@ScriptDir & '\A.ini', 'section', '4', GUICtrlRead($Combo4)) ConsoleWrite(GUICtrlRead($Combo4) & @CRLF) Case $Button3 imag() Case $Button1 GUICtrlSetData($Button1, 'Started') While Function() Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndSwitch WEnd EndFunc ;==>_Main Func Function() $min = IniRead('A.ini', 'section', '1', '') $hour = IniRead('A.ini', 'section', '2', '') $calendar = IniRead('A.ini', 'section', 'calendar', '') $open = IniRead('\A.ini', 'section', 'open', '') Sleep(50) If @MIN = Number($min) And @HOUR = Number($hour) Then If ProcessExists('notepad.exe') Then MsgBox(0, 'Attention Time now is ' & @HOUR & ':' & @MIN, '=== Notepad is running. ===' & @CRLF & @CRLF & 'Starting ' & _ $hour & ':' & $min & @CRLF & 'Ending ' & $hours & ':' & $mins, 5) Else Run('NotePad.exe') EndIf EndIf EndFunc ;==>Function Close() Func Close() $mins = IniRead('A.ini', 'section', '3', '') $hours = IniRead('A.ini', 'section', '4', '') Sleep(50) If ProcessExists('NotePad.exe') Then If @MIN = Number($mins) And @HOUR = Number($hours) Then clos() EndIf EndIf EndFunc ;==>Close Func imag() $file = FileOpenDialog("Select file", @ProgramFilesDir & "", "Application (*.exe)", 1 + 4) While 1 If @error Then GUICtrlSetData($path_source, "") Else $iconfile_to_use = $file $array = StringSplit($iconfile_to_use, '\', 1) $name = $array[$array[0]] $newname = StringReplace($name, ".exe", "") $hImage = _GUIImageList_Create(32, 32, 5, 3, 6) _GUIImageList_AddIcon($hImage, $iconfile_to_use, 0, True) _GUICtrlButton_SetImageList($Button3, $hImage, 4) GUICtrlSetData($path_source, $file) IniWrite(@ScriptDir & '\A.ini', 'section', 'open', GUICtrlRead($path_source)) ConsoleWrite(GUICtrlRead($path_source) & @CRLF) EndIf ExitLoop WEnd EndFunc ;==>imag Func clos() GUICtrlSetData($Button1, 'Ending !!!') Sleep(13) $list = ProcessList('NotePad.exe') ProcessClose($list[1][1]) Sleep(10) MsgBox(0, '', 'Closing everything !', 6) EndFunc ;==>clos now i gonna look into... EDIT: can you post the ini file to see if the format is right? Edited July 2, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
ussr Posted July 3, 2011 Author Share Posted July 3, 2011 HI The ini file example: [section] 2=08 1=25 open=D:\Program Files\HideIPEasy\HideIPEasy.exe 4=11 3=24 Link to comment Share on other sites More sharing options...
ussr Posted July 3, 2011 Author Share Posted July 3, 2011 I forgot to put this this cod behind the $Button1 IniWrite(@ScriptDir & '\A.ini', 'section', 'calendar',GUICtrlRead($MonthCal1)) ConsoleWrite(GUICtrlRead($MonthCal1) & @CRLF) Now the ini : [section] 2=08 1=25 open=D:\Program Files\HideIPEasy\HideIPEasy.exe 4=11 3=24 calendar=2011/07/02 I dont know how to read the calendar ini @YEAR, @MON, @MDAY. If I know It would be like this function() If @MIN = Number($min) And @HOUR = Number($hour)And @YEAR\ @MON\@MDAY=Number($calendar)Then Link to comment Share on other sites More sharing options...
guinness Posted July 3, 2011 Share Posted July 3, 2011 When posting code please use the [autoit][/autoit] tags to make the code more readable. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Developers Jos Posted July 3, 2011 Developers Share Posted July 3, 2011 HideIPEasy.exeThat explains a lot. 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...
ussr Posted July 3, 2011 Author Share Posted July 3, 2011 That is just a crazy application. I could be Utorrent.exe or anything. Example :I have Plusnet internet and from 12pm till 8 am the internet free. else I have 60 GB download limit/month . This script could start Utorrent 12pm and close It 8am.If someone fix the calendar part I also could schedule the next days. 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