
FitzChivalry
Active Members-
Posts
50 -
Joined
-
Last visited
Everything posted by FitzChivalry
-
OK, I've tried out a few free backup options, and none of them do what I want. So........ I made my own with autoit! Anyways, I am running into a slight problem when using dircopy and filecopy. I myself will really only use this script to backup entire directories, but I want to make it possible to back up individual files as well. The problem is, when you use dircopy on a file, or filecopy on a dir, it gives back an error. I've included my script below, and you can see that I made a _Copy function to try doing a dircopy, then filecopy if there was an error, but this is not working correctly. Is there a function or something that will copy something, no matter if it is a file or a dir?? Other than that question, if anyone has any suggestions for optimizing/prettifying my code, please let me know. I'm working on a gui for making the .ini file now, and as soon as that is done I'll post this over in example scripts for further review. Just wanted to get some first impressions first :-) ;backup ;MsgBox(0, "start", "starting!") ;------------------------ #cs Backs up directorys fine... does includes and excludes perfectly for directories. I can do the same for individual files.... but is it really worth it? I'd kind of rather move onto the gui for creating the ini file. Maybe once I do that I'll come back and do files Files should be pretty much the same as directories, just change dircopy to filecopy #ce ;----------------------- #include <File.au3> #include <Array.au3> #include <Date.au3> While 1 Sleep(10000) ;~ MsgBox(0, '', "The wday is: " & @WDAY) $ini = @ScriptDir & "\backup.ini" $wday = IniRead($ini, "Schedule", "wday", 1) $hour = IniRead($ini, "Schedule", "hour", 17) $runflag = IniRead($ini, "Schedule", "RunFlag", 1) ;~ MsgBox(0, "starting", $wday) If $hour == @HOUR Then ;need to change this to @wday or @mday depending on how often i want it to run... If $runflag == 1 Then ;~ MsgBox(0, "starting", "should call backup() now...") $backup = Backup($ini) If $backup == 0 Then ;if an error with the backup, then try again $backup = Backup($ini) If $backup == 1 Then ;if the second time is succesful, set the flag to 0 so it wont run again $runflag = 0 Else ;but if it fails again, set the flag to 1, so it will try to run again in the next period of time $runflag = 1 EndIf Else $runflag = 0 EndIf IniWrite($ini, "Schedule", "RunFlag", $runflag) Else ;~ MsgBox(0, "not running backup", "not right day, or already run today!", 1) EndIf Else IniWrite($ini, "Schedule", "RunFlag", 1) EndIf WEnd Func Backup($ini) $BackupDest = IniRead($ini, "Destination", "Dest", "ERROR") $BackupSource = IniRead($ini, "Files", "Source", "ERROR") ;MsgBox(0, "location", $BackupDest) $file = _FileCreate($BackupDest & "\btest.txt") ;~ MsgBox(0, "fileopen", $file) $del = FileDelete($BackupDest & "\btest.txt") ;~ MsgBox(0, "fileopen", $del) $BackupDest = $BackupDest & "\" & @YEAR & "-" & @MON & "-" & @MDAY ;$drive = DriveStatus("j:\") ;MsgBox(0, "J", $drive) If $file > 0 Then $FileList = _FileListToArray($BackupSource, "*", 2) If @error = 1 Then MsgBox(0, "ERROR", "No Files\Folders Found to backup. Check .ini file") Exit EndIf ;_ArrayDisplay($FileList, "$FileList") ;--------------------------- ;Do specific includes here ;--------------------------- $includeFile = IniReadSection($ini, "Include") _ArrayDisplay($includeFile, "$FileList") If IsArray($includeFile) Then $i = 1 While $i < $includeFile[0][0] + 1 ;now need to add in includes and excludes $copy = DirCopy($includeFile[$i][1], $BackupDest & "\IncludeFiles\", 1) ;~ $copy = FileCopy("C:\Documents and Settings\Rick\My Documents\My Music\iTunes\iTunes Music\Podcasts\Escape Pod\EP97_ Cinderella Suicide.mp3", "J:\external\backups\autoit\test\IncludeFiles\", 9) ;~ MsgBox(0, "Copied", $copy & $includeFile[$i][1]) $i = $i + 1 WEnd EndIf ;-------------------------- ;Process regular source to dest copying here, excluding excludes $ExcludeFile = IniReadSection($ini, "Exclude") ;~ _ArrayDisplay($ExcludeFile, "$FileList") $i = 1 While $i < $FileList[0] + 1 ;now need to add in includes and excludes $source = $BackupSource & "\" & $FileList[$i] ;~ MsgBox(0, "Preparing to test source", $source) $ii = 1 $exit = 1 If IsArray($ExcludeFile) Then While $ii < $ExcludeFile[0][0] + 1 ;~ MsgBox(0, "testing against", $ExcludeFile[$ii][1]) If $source == $ExcludeFile[$ii][1] Then ;~ MsgBox(0, "Source should be excluded!", $source) $exit = 0 ExitLoop EndIf $ii = $ii + 1 WEnd EndIf ;if source is not in exclude array, then If $exit == 1 Then $copy = DirCopy($source, $BackupDest & "\" & $FileList[$i], 1) ;~ MsgBox(0, "Copied", $copy & $FileList[$i]) EndIf $i = $i + 1 WEnd IniWrite($ini, "Time", "LastSuccessfulBackup", _Now()) MsgBox(0, "Complete", "Sucessfuly backed up to: " & $BackupDest, 3) Return 1 Else IniWrite($ini, "Time", "LastFailedTry", _Now()) MsgBox(0, "Backup ERROR", "Destination not ready! Please connect and try again. Destination set to: " & $BackupDest) Return 0 EndIf EndFunc ;==>Backup Func _Copy($fsource, $fdest) $copy = 0 $r = "ERROR" $copy = DirCopy($fsource, $fdest, 0) If $copy == 0 Then $copy = FileCopy($fsource, $fdest, 8) If $copy == 0 Then $r = "error" Else $r = "FileCopy" EndIf Else $r = "DirCopy" EndIf Return $r EndFunc ;==>_CopyoÝ÷ ٩ݶ¬jjez)â~)^¶!©®²)àjëh×6[Destination] Dest=J:\External\Backups\Autoit [Files] Source=C:\Documents and Settings\Rick\My Documents [Exclude] 1=C:\Documents and Settings\Rick\My Documents\My Music 2=C:\Documents and Settings\Rick\My Documents\My Pictures [Include] C:\Documents and Settings\Rick\My Documents\My Music\Podcasts\Escape Pod\EP97_ Cinderella Suicide.mp3 [Time] LastFailedTry=8/7/2008 3:29:21 PM LastSuccessfulBackup=8/7/2008 5:36:42 PM [Schedule] wday = 5 RunFlag=1 hour = 17
-
Ok, had some spare time today, so I decided to see if I could get the bot to click on ads as it goes through the words. I've tested this on my machine, and it seems to be working fine. It was actually a lot easier than I thought it would be, turns out that the ads are alway's the 14th link on the page, so just using _IELinkClickByIndex ($oIE, 13, 0) seems to work without any problems. Right now the bot is set to randomly click on an ad 1/30th of the time. That might be too frequent, if it is just change the max random number to a higher one. Comments and improvements welcome! #include <IE.au3> #include <INet.au3> #include <String.au3> #include <GUIConstants.au3> Global $Correct = 0, $False = 0, $First = 1, $Label, $Timerdiff, $Formtitle, $Minute = 0, $Ads =0 $oIE = _IECreate("http://freerice.com", 1, 0) HotKeySet("{F10}", "hideshow") While 1 $Timer = TimerInit() $html = _IEBodyReadHTML($oIE) Check() $Word = StringRegExp($html, "(?i)<li><strong>(.*?)</strong>", 1) $LearnWord = StringRegExp($html, '(?i)incorrect>(.*?)</div>', 1) If IsArray($LearnWord) Then $splitted = StringSplit($LearnWord[0], "=") $learn = StringStripWS($splitted[1], 2) $means = StringStripWS($splitted[2], 1) ConsoleWrite(">Learned a new word!: " & $LearnWord[0] & @CRLF) IniWrite("learning.ini", "Learned words", $learn, $means) EndIf $isLearned = IniRead("learning.ini", "Learned words", StringStripWS($Word[0], 8), "") If $isLearned <> "" Then ConsoleWrite("+>Found synonym. Clicking by text(learned word): " & $isLearned & @CRLF) _IELinkClickByText($oIE, $isLearned) Else $SynonymsG = _GetSyn(StringStripWS($Word[0], 8)) If IsArray($SynonymsG) Then $oLinks = _IELinkGetCollection($oIE) $Found = False For $oLink In $oLinks For $a = 1 To $SynonymsG[0] If StringInStr($oLink.href, "Javascript") Then $test = _IEPropertyGet($oLink, "innertext") If StringInStr($SynonymsG[$a], $test) Then $WordToClick = $test $Found = True ExitLoop (2) EndIf EndIf Next Next Else $Found = False EndIf If $Found Then ConsoleWrite("+>Found synonym. Clicking by text: " & $WordToClick & @CRLF) _IELinkClickByText($oIE, $WordToClick) Else ConsoleWrite("-> Could not find synonym. Clicking random word." & @CRLF) _IENavigate($oIE, "java script: submitForm('" & Random(1, 4, 1) & "')") EndIf EndIf Sleep(1000) $Timerdiff += TimerDiff($Timer) $Second = Round($Timerdiff / 1000, 0) If $Second >= 60 Then $Second = 0 $Minute += 1 $Timerdiff = 0 EndIf GUICtrlSetData($Formtitle, " Rice Bot - Minute: " & $Minute & " Second: " & $Second) $random = Random(1,30,1) if $random = 1 Then clickAd() EndIf WEnd Func hideshow() If _IEPropertyGet($oIE, "visible") Then _IEAction($oIE, "invisible") Else _IEAction($oIE, "visible") EndIf EndFunc ;==>hideshow Func _GetSyn($sWord) $sSource = _INetGetSource("http://www.synonymer.se/en/?query=" & $sWord & "&btnS=Find+synonyms") $synonyms = StringRegExp($sSource, '(?i)class="synonym">(.*?)</TR>', 1) If Not IsArray($synonyms) Then Return 0 $syns = StringSplit($synonyms[0], ",") Return $syns EndFunc ;==>_GetSyn Func Check() If $First = 1 Then ;_IEAction($oIE, "invisible") $Width = 270 $Height = 70 $Form = GUICreate("Rice Bot", $Width, $Height, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) $Formtitle = GUICtrlCreateLabel(" Rice Bot", 0, 4, @DesktopWidth, 20, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Formtitlebackground = GUICtrlCreateGraphic(0, 0, @DesktopWidth, 22) GUICtrlSetBkColor(-1, 0x000000) $Label = GUICtrlCreateLabel("", 8, 25, $Width, 50) GUISetState() WinSetTrans($Form, "", 200) $First = 0 EndIf $Amount = _StringBetween($html, '<P id=donatedAmount>', '</P>') If IsArray($Amount) Then $Amount2 = StringRegExp($Amount[0], "[[:digit:]]+", 1) If Not @error Then If StringInStr($html, '<div id=correct>CORRECT!</div>') Then $Correct += 1 Else $False += 1 EndIf GUICtrlSetData($Label, "You have now donated " & $Amount2[0] & " grains of rice." & @CRLF & "Correct : " & $Correct & " False : " & $False & " Correct Percentage : " & Round((($Correct / ($Correct + $False)) * 100), 0) & "%"& @CRLF & "Ads clicked: " & $Ads) EndIf EndIf EndFunc ;==>Check Func clickAd() _IELinkClickByIndex ($oIE, 13, 0) sleep(3000) _IENavigate ($oIE, "http://freerice.com") $Ads +=1 ConsoleWrite("-> Clicking on an ad" & @CRLF) EndFunc
-
Move mouse to Quick Launch Icon
FitzChivalry replied to patgenn123's topic in AutoIt General Help and Support
The way I've done it is to use the window Info application that comes with autoit to find the pixel color of the button that you want to click, then in your script do a PixelSearch for it and then MouseClick on the button. This is assuming you want to actually click on the button... If you just want to run the program you can use the Run command. -
_Timer_GetIdleTime() errors?
FitzChivalry replied to FitzChivalry's topic in AutoIt General Help and Support
Sweet! Thanks for your help, I'll be making good use of this for my program, I'll post it over in example scripts once it's polished up a bit. Thanks again! -
_Timer_GetIdleTime() errors?
FitzChivalry replied to FitzChivalry's topic in AutoIt General Help and Support
Here's the output for your simplified program: Debug: 16:00:29 Unconverted = 10500 Converted = 0:0:11 Debug: 16:00:39 Unconverted = 20500 Converted = 0:0:21 Debug: 16:00:49 Unconverted = 30500 Converted = 0:0:31 Debug: 16:00:59 Unconverted = 11801718 Converted = 3:16:42 Debug: 16:01:09 Unconverted = 9437 Converted = 0:0:9 Debug: 16:01:19 Unconverted = 19437 Converted = 0:0:19 Debug: 16:01:29 Unconverted = 2359 Converted = 0:0:2 Debug: 16:01:39 Unconverted = 172 Converted = 0:0:0 Debug: 16:01:49 Unconverted = 11851718 Converted = 3:17:32 It seems that maybe this only happens if the computer is active at exactly the time it checks for the idle time? I was just bouncing my mouse around the screen, and every time I kept the mouse moving rapidly it gave back the strange numbers. That could be just a coincidence though. -
_Timer_GetIdleTime() errors?
FitzChivalry replied to FitzChivalry's topic in AutoIt General Help and Support
lol, why didn't I think of that????? Here's the output: Debug: Unconverted = 687 Converted = 0:0:1 Incremented activetime, it is: 0.5 Debug: Unconverted = 11011765 Converted = 3:3:32 Debug: Unconverted = 8906 Converted = 0:0:9 Incremented activetime, it is: 1 Debug: Unconverted = 38906 Converted = 0:0:39 Incremented activetime, it is: 1.5 Debug: Unconverted = 68906 Converted = 0:1:9 Incremented activetime, it is: 2 Debug: Unconverted = 98921 Converted = 0:1:39 Incremented activetime, it is: 2.5 Debug: Unconverted = 128921 Converted = 0:2:9 Incremented activetime, it is: 3 Debug: Unconverted = 4718 Converted = 0:0:5 Incremented activetime, it is: 3.5 Debug: Unconverted = 11221796 Converted = 3:7:2 Debug: Unconverted = 11251812 Converted = 3:7:32 Debug: Unconverted = 28953 Converted = 0:0:29 Incremented activetime, it is: 4 Debug: Unconverted = 11311812 Converted = 3:8:32 It seems like the strange values are steadily incrementing along, it goes from 3:7:32 to 3:8:32 1 minute later. So it looks like it is tracking something, but I'm not sure what... [EDIT] Didnt' see your simplified script, this output was done by just modifying my own script... I'll run yours to see if it changes the output, there could be something funky in my script as well [\EDIT] -
Change the Icon of the .exe
FitzChivalry replied to fireking300's topic in AutoIt General Help and Support
I'm assuming you are just right-clicking and selecting compile right now. If you instead go to the Autoit folder on your start menu, there is a "Compile script to EXE" option, using that you can select the source (.au3) file, where to output the EXE, and what icon file to use for it. You will need a .ico file, and most image editors can save jpegs or whatever you have as a .ico to use. Hope that helps. -
Question for everyone. I'm making an app to track computer usage in our labs here at work, and I'm using the excellent little function made by PsaltyDS called _Timer_GetIdleTime(). The problem I'm having is that every once in a while the idle time will jump from around 10 seconds to 3 hours, then back down to 10 seconds. This could be a problem either with my computer, the function, or with _TicksToTime(), but I'm not sure which or what the best way to find out for sure would be. I'll post my code below here, along with some sample output, and if anyone could offer any help or suggestions on ways to further allow me to figure out exactly where the problem is happening, that would be great! ;time2.au3 #include <Date.au3> ; For _TicksToTime() only #include <Process.au3> Opt("TrayIconHide", 1) Global $Paused HotKeySet("{ESC}", "Terminate") ; author: FitzChivalry at www.autoitscript.com/forum #cs TODO Add activetime per application get windowtitle, running process, other extra information ;reg key for dell serial number is in ;HKLM\Software\Altiris\Client Service\LastUpdateComputerInfo ;Have to read and parse the reg key it looks like..... #ce ;---------------------------------------------------------------------- $idletime = 5 ;number of minutes to wait before counting as idle time $scantime = 30000 ;in milliseconds, so 5000 = 5 seconds $filename = "\\altirisserver\eXpress\Apps\timescans\timelog2.csv" $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Client Service", "LastUpdateComputerInfo") $Serial = StringRegExp($var, "(?:Serial)(?:-Number=)([[:alnum:]]{7})", 1) $activeperhour = 0 $startactive = 0 $write = 0 ;----------------------------------------------------------------------- ;ConsoleWrite("starting script") While 1 $idle = _Timer_GetIdleTime() ;MsgBox(4096,"",$idle) Global $Hr, $Min, $Sec _TicksToTime($idle, $Hr, $Min, $Sec) ConsoleWrite("Debug: Converted = " & $Hr & ":" & $Min & ":" & $Sec & @LF) scan() Sleep($scantime) WEnd Func scan() ;so if idle is greater than the idletime(10 min), then i need to increase idletimeperhour. That by itself would be pretty easy to do, but I also need to make sure that each time the hour switches ;it records the total idle time for that hour. If @MIN = 02 Then $write = 0 ConsoleWrite("write is now 0") EndIf ;how to make it so that it writes the time in the correct hour? If @MIN == 59 And $write = 0 Then ConsoleWrite("writing to file!") $line = $Serial[0] & ", " & @ComputerName & ", " & @UserName & ", " & _NowDate() & ", " & @HOUR & ", " & $activeperhour $file = FileOpen($filename, 1) FileWriteLine($file, $line) FileClose($file) $activeperhour = 0 $write = 1 Else If $Min < $idletime And $Hr = 0 Then $activeperhour = $activeperhour + (60000/$scantime);This gets the fraction of the minute to increment activetime ConsoleWrite("Incremented activetime, it is: " & $activeperhour & @LF) EndIf EndIf EndFunc ;==>scan Func Terminate() Exit 0 EndFunc ;==>Terminate ; ================================================ ; function: _Timer_GetIdleTime() ; purpose: Returns the number of ticks since last user activity (i.e. KYBD/Mouse) ; syntax: _Timer_GetIdleTime() ; returns: On success: integer ticks since last (approx. milliseconds) since last activity ; notes: The current ticks since last system restart will roll over to 0 every 50 days or so, ; which makes it possible for last user activity to be before the rollover, but run time ; of this function to be after the rollover. If this happens, @extended = 1 and the ; returned value is ticks since rollover occured. ; author: PsaltyDS at www.autoitscript.com/forum ; ================================================ ; Change log: ; v1.0.0 -- 03/20/2008 First version ; ================================================ Func _Timer_GetIdleTime() ; Get ticks at last activity Local $struct = DllStructCreate("uint;dword"); DllStructSetData($struct, 1, DllStructGetSize($struct)); DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($struct)) ; Get current ticks since last restart Local $aTicks = DllCall("Kernel32.dll", "int", "GetTickCount") ; Return time since last activity, in ticks (approx milliseconds) Local $iDiff = $aTicks[0] - DllStructGetData($struct, 2) If $iDiff > 0 Then ; Normal return Return $iDiff Else ; Rollover of ticks counter has occured Return SetError(0, 1, $aTicks[0]) EndIf EndFunc ;==>_Timer_GetIdleTimeoÝ÷ Ù&¦¦W¨ºÚn¶ØZ¶ÈhÂËajÛ(ëaxºy2È(x(«¢+ÙÕè ½¹ÙÉÑôÀèÀèÌ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÈà)Õè ½¹ÙÉÑôÈèäèÈÀ)Õè ½¹ÙÉÑôÀèÀèÜ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÈà¸Ô)Õè ½¹ÙÉÑôÀèÀèÈ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÈä)Õè ½¹ÙÉÑôÀèÀèÌÈ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÈä¸Ô)Õè ½¹ÙÉÑôÀèÀèÀ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÌÀ)Õè ½¹ÙÉÑôÀèÀèÄ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÌÀ¸Ô)Õè ½¹ÙÉÑôÀèÀèÀ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÌÄ)Õè ½¹ÙÉÑôÀèÀèÄÈ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÌĸÔ)Õè ½¹ÙÉÑôÈèÄÌèÈÀ)Õè ½¹ÙÉÑôÀèÀèÀ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÌÈ)Õè ½¹ÙÉÑôÀèÀèÀ)%¹Éµ¹ÑÑ¥ÙÑ¥µ°¥Ð¥ÌèÌȸÔ)Õè ½¹ÙÉÑôÀèÀèÄ
-
Find the executable of the active window?
FitzChivalry replied to FitzChivalry's topic in AutoIt General Help and Support
Coolness. After looking around some more, I also found a udf that will work as well. The full command is _ProcessGetName(WinGetProcess(WinGetTitle("")))). Thanks all! -
Question for all... I'm working on a time management program similar to rescuetime (www.rescuetime.com). It's been pretty easy to do with autoit so far, but I'm having a problem with finding the actual process that is running the active window. The window title is easy, as is the actual process ID just using the built in WinGetText and WinGetProcess. Is there a way to get the name of the executable from either the title or the PID? I've searched through the forum here and cant find anything that seems to help, so any and all suggestions appreciated!
-
Hey all, I'm working on making an automated installer for the Folding at Home project, but I'm running into some problems. For some lame reason, the installer is set up in a way that you have to type in the configuration settings, there is no way to set it up with command line switches or a config file. Frustrating, but Autoit makes it a lot easier. The problem I am having is that the options for installing change depending on wether or not you have previously installed FAH before. I want it to run as a service, and if I am installing it for the first time then I enter 'yes' to the question, but if it is being reinstalled then I have to enter 'no'. The prompt is different for the question, so if I could read the text from the cmd prompt then I could just use a simple if statement and solve all my problems. How do I read text from the cmd prompt? I've tried using WinGetText and StdoutRead, but both dont return anything. I'm stuck here, any help would be really appreciated!
-
Help loading different imagesinto my GUI
FitzChivalry replied to FitzChivalry's topic in AutoIt GUI Help and Support
Cool, I didnt know that, but it works great. Zedna, for some reason when I was using GUICtrlSetImage, it would only work for the first 2 pictures that it showed, then stopped showing any more...not exactly sure why. What I ended up doing is using ;-------this now works ok.... just using setimage didnt work right, so now i'm using a combination ;$n=GUICtrlCreatePic(@ScriptDir &"\blank.jpg",1,30,0,0) $n = GUICtrlSetImage($n, @ScriptDir &"\blank.jpg") $n=GUICtrlCreatePic(@ScriptDir &"\" & $piclist[$i],1,30,0,0) ;~ $n = GUICtrlSetImage($n, @ScriptDir &"\" & $piclist[$i]) SplashImageOn("Test", @ScriptDir &"\blank.jpg",@DesktopWidth, @DesktopHeight -30) sleep(50) SplashOff() ;------------- I did this because my gui would never refresh to show the newest image displayed. I couldnt find any option to force the GUI to refresh itself, so doing the splash works.... not the most elegant solution, but it is working better then before. If anyone has any other suggestions to try I'd welcome them, but it seems to be working ok now.... Thanks for the help all!! -
Help loading different imagesinto my GUI
FitzChivalry replied to FitzChivalry's topic in AutoIt GUI Help and Support
ahh hah! That does seem to work better :-) many thanks! Anyone have any ideas about making the picture appear in it's normal size? -
Ok, so I'm not really that familiar with GUI's, but I've been working on this one for a bit. The idea is to use it to study paintings like flashcards. I have a bunch of pictures in the script directory, and when I run it like it is now it runs ok, but I have 2 main questions on how to improve it. 1. It stretches the pictures to funny proportions. I know that when using GUICtrlCreatePic if you leave the options for width and height undefined, it will default to the last used one. Is there any way to make it default to the actual picture size so it will look normal? 2. When I try and move to the next picture, my GUI wont refresh. It will still show the old picture unless you switch away from that window and then switch back. I'm temporarily working around this by using: ;This is the part i'm worried about, there has got to be a better way to do this.... $n=GUICtrlCreatePic(@ScriptDir &"\" & $piclist[$i],1,30,700,700) SplashImageOn("Test", @ScriptDir &"\" & $piclist[$i],700,700) sleep(50) SplashOff() ;-------------oÝ÷ ÛbrhzǺÇéx.§v-¢·ë!nëbßÙ§¢ÛÞ¯(Z¦n¶f²êÞ¶«z+mëmz¼É8h±æ«zl¶ªç¬¶*'±¼ºY¡×¢²)Üç^u·¥£(j|¨çßz¶§Êj+z'^jÊ'-¢)©®ÞÔájy,ßv®¶s` ¢6æ6ÇVFRfÇC´uT6öç7FçG2æS2fwC°¢6æ6ÇVFRfÇC´fÆRæS2fwC°¢6æ6ÇVFRfÇC´'&æS2fwC° ¢b33c·6Æ7BÒôfÆTÆ7EFô'&67&DF"ÂgV÷C²¢æ§rgV÷C²Â£µô'&F7Æb33c·6Æ7B ¤uT7&VFRgV÷C´×uT7GW&RgV÷C²ÃsÃsÂÓÂÓÂb33cµu5õ4¤T$õ²b33cµu5õ54ÔTåR ¤uT6WD&´6öÆ÷"Sdddb ¢b33c´'WGFöæÒuT7G&Ä7&VFT'WGFöâgV÷C´ç7vW"gV÷C²ÂÂRÂSÂ#R¢b33c´'WGFöæâÒuT7G&Ä7&VFT'WGFöâgV÷C´æWBgV÷C²ÂÂRÂSÂ#R ¤uT6WE7FFR¢b33c¶Ò¢b33c¶ãÔuT7G&Ä7&VFU267&DF"fײgV÷C²b3#²gV÷C²fײb33c·6Æ7E²b33c¶ÒÃÃ3ÃsÃs£²'VâFRuTVçFÂFRFÆör26Æ÷6V@¥vÆR ¢b33c¶×6rÒuTvWD×6r bb33c¶×6rÒb33c´'WGFöæFVà ×6t&÷ÂgV÷C´ç7vW"gV÷C²Âb33c·6Æ7E²b33c¶ÒÂ" uT7G&Å6WE7FFRb33c´'WGFöæâÂb33c¶wVöfö7W2 VæD` bb33c¶×6rÒb33c´'WGFöæâFVà ´×6t&÷ÂgV÷C¶6Æ6¶VBgV÷C²ÂgV÷C¶æWBgV÷C² b33c¶Òb33c¶³ bb33c¶fwC²b33c·6Æ7E³ÒFVâWDÆö÷ µF22FR'Bb33¶Òv÷'&VB&÷WBÂFW&R2v÷BFò&R&WGFW"vFòFòF2âââà b33c¶ãÔuT7G&Ä7&VFU267&DF"fײgV÷C²b3#²gV÷C²fײb33c·6Æ7E²b33c¶ÒÃÃ3ÃsÃs 7Æ6ÖvTöâgV÷CµFW7BgV÷C²Â67&DF"fײgV÷C²b3#²gV÷C²fײb33c·6Æ7E²b33c¶ÒÃsÃs 6ÆVWS 7Æ6öfb ²ÒÒÒÒÒÒÒÒÒÒÒÒÐ uT7G&Å6WE7FFRb33c´'WGFöæÂb33c¶wVöfö7W2 uT6WE7FFRb33c´uTôôåDõ VæD`¢¢bb33c¶×6rÒb33c´uTôUdTåEô4Äõ4RFVâWDÆö÷¥vVæ@ ¤×6t&÷ÂgV÷CµFæ·2gV÷C²ÂgV÷C´vööB¦ö"7GVGærb333²gV÷C²
-
How to not display error messages?
FitzChivalry replied to FitzChivalry's topic in AutoIt General Help and Support
Yes! thanks! Now that i'm searching through the help file for that option I can see it, but couldnt before :-) -
Ok, I know there is a way to do this, I just cant quite remember... I've looked around on the forums and through my old scripts, but cant find the right option. I have a autoit script that occasionally runs into some problems. When it does, it displays an error message to the user and then exits. I would like to instead have it write the error message to a log file, Not display it to the user, and Not exit. What is the correct way to have it not display the error messages? Is there a way to have it not exit but continue running as well? Thanks
-
IF keys pressed then do something? HELP
FitzChivalry replied to Dtvscrotes's topic in AutoIt General Help and Support
try using HotKeySet("{!d}", "click") func click() msgbox(0,"title","you pressed alt d ") endfunc -
Ok, so I need to make a small application to replace the quicklaunch toolbar. I have made a GUI that will launch all the programs and stuff, that is not the hard part. The problem now is that the GUI that I made is going to possibly cover up part of whatever application the user is running, so my boss wants me to put it on the taskbar right next to the start menu button where the quicklaunch normally is. Does anyone know if this is possible to do with autoit? I've looked around on the forums for something similar, and found a lot about making toolbars like at the top of MS word, but I need one that will go on the taskbar. Any comments/help/suggestions are welcome!
-
Run java program with cmd args?
FitzChivalry replied to FitzChivalry's topic in AutoIt General Help and Support
I figured it out after sleeping on it one more time. The correct command is: Run("java -jar email.jar " & $text, "C:\Documents and Settings\AllisonRS\email\dist\") I just had to set the working directory, I remember that messed me up in a couple other programs as well... thanks for the help everyone! -
ok. I dont know exactly why you would want to do that, but what i would do is just put a bunch of sleep(1000 * 60 * $time) (1sec * 60 = 1 min, * how many min they want the script to take) throughout my code, probably 10 of them, and then read from the gui whichever time they want, divide that by 10, and set $time equal to that. ie, if they select 2 hrs: $time = 120/10 code... sleep(1000 * 60 * $time) (12 min) code... sleep(1000 * 60 * $time) code... sleep(1000 * 60 * $time) etc, etc. OR, you could just have it wait 119 minutes then execute... this will leave a lot of time where your script is just waiting around doing nothing, but it sounds like that is what you want. hope it helps!
-
what exactly to you mean? do you want the script to repeat itself every x hours, or you want it to run once, and that one run should take x hours?
-
Run java program with cmd args?
FitzChivalry replied to FitzChivalry's topic in AutoIt General Help and Support
no it does not... it throws the error: Run("C:\docs and settings\..\..\dist\java -jar email.jar") Error: unable to execute the external program. The system cannot find the file specified. [edit] when i run the jar from console, it throws ArrayOutOfBounds exception because there is no cmdline arg [/edit] -
So I have a .jar file that I'm trying to run with some command line arguments from autoit. My java program works fine from the console when I type in "java -jar email.jar filename", but I can't get it to run directly from autoit. I've tried: Run("C:\Documents and Settings\AllisonRS\email\dist\java -jar email.jar X:\Apps\labchecklogs\Daily\20070605oklog.txt") Run(@ComSpec & " /c " & 'C:\Documents and Settings\AllisonRS\email\dist\java -jar email.jar X:\Apps\labchecklogs\Daily\20070605oklog.txt', "", @SW_HIDE) ShellExecute("C:\Documents and Settings\AllisonRS\email\dist\java -jar email.jar X:\Apps\labchecklogs\Daily\20070605oklog.txt") and some other things that i cant quite remember exactly what. The point is, my java program never ran correctly. I've done some searching around on the forums here, and it seems it can be done by writing to a batch file and running that, but that is not something i want to do. The cmd argument filename will be a variable, just wondering if anyone has any experience using autoit with java. I'm pretty sure it is something simple, but I have been working on this problem for a while and can't seem to think straight anymore. Any help would be appreciated. Thanks!
-
I've used that code for a while and i'ts pretty solid. It doesnt seem to work on my computer at work because it is behind a proxy etc, but it works on my home computers great.
-
How does it malfunction? It works fine for me with archers... what is happeing for you?