Exe. Problems Im not sure what to do

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
nick
Newbie
Posts: 6
Joined: Sun Apr 05, 2009 9:06 pm

Exe. Problems Im not sure what to do

Post by nick » Tue Apr 07, 2009 4:31 pm

Sorry to bother you all again,

I have put together a script using macro schedule pro that i have recently bought to locate an image on the screen and then to click it etc, this all works fine but here is my problem.

I compiled it to an exe. to use it on another computer which runs vista. I run the exe. and the macro's picture recognition doesn't work on that computer.

So i downloaded the macro schduler trial and installed it on that computer and i then copied the script and images to see if the images i had compiled would work on that computer, i put it together and then press run from the macro schedule trial window and it then worked.

So i am wondering if there is a problem compiling scripts to an exe. from a window xp system to then use them on a dif computer that runs vista or am i doing something wrong .

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Apr 07, 2009 4:34 pm

Paths perhaps? Where are the .bmp files that the script needs to do the image recognition? Is it finding them? What values are being returned from FindImagePos? This will give you some clues. Use _DUMP_VARS and run the exe with /LOGFILE or use some MessageModals to show some diagnostics such as the return values from FindImagePos etc.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

nick
Newbie
Posts: 6
Joined: Sun Apr 05, 2009 9:06 pm

Post by nick » Tue Apr 07, 2009 10:13 pm

Omg lol,

Sorry guys im a newbie to this,
yea i thought the images were compiled into the exe if not then there is my problem.

Thanks for your time and help.

Just a quick question will the images need to just be in the same folder as the exe or will they need to be in the same directory of folders from where i said they would be in the script.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Apr 08, 2009 3:25 am

If your script is calling for images in a specific directory, then that is where they must be on any machine.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Apr 08, 2009 6:45 am

I would put them in the same location as the EXE/Script and refer to them with %SCRIPT_DIR% in place of the path. SCRIPT_DIR means same folder as script/exe self.

Or: If you want to "compile them in" you can import them into the script with Tools/Import Binary Data and at run time export using ExportData. In this case it may make sense to export them and refer to them in the temp folder using %TEMP_DIR%
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Apr 08, 2009 5:48 pm

This is good timing .... I just posted the following in another thread, but it could be helpful here for you also.

You should frequently use variable paths in your scripts, especially if they may be compiled to run on other systems. Here is an example of some of them, Marcus has already referred to some of them:

Variable paths, like these:
Built in with Macro Scheduler
%Win_Dir%
%Script_Dir%
%Desktop_Dir%
%Temp_Dir%
%Sys_Dir%

Samples of some others from the Environment
GetEnvVar>HomePath,vHomePath
GetEnvVar>UserProfile,vUserProfile
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Application Data Path

Post by kpassaur » Mon Mar 15, 2010 3:52 pm

I am looking for a way to determine the "C:\Documents and Settings\All Users\Application Data" on a machine that may not have the english version.

I have searched the forum, and have tried about everything I can think of. I have tried the VBScript Get Folder method as shown here

VBEval>GetFolder("AppData"),AppData

I went to the Microsoft link that had more optons, as this returns if for the current user. Some return the same values even if you change what you put in, which does not make a lot of sense.

I have tried the GetEnvVar method that works when you use "Allusersprofile" and add the subfolder "Application Data" however, if it is in german will it be "Application Data"?

Maybe I am missing something, but if I compile a script I would like to be able to load it as a service, which I should be able to do if it is under All Users\Application Data.

Currently I have been using the vbscript method of GetFolder("AppData"),AppData as mentioned above and it loads as a service when the user logs on, but the user has to log on which is the difficulty. I just really need to have a way where it can be loaded and run without logging on as a particular user and I believe the only way is under all users.

Also, to load the compiled script as a service and make setup easy I use LaunchServ.exe from http://emutastic.emulation64.com/netosoft which is freeware. It is ten times easier than doing it following Microsoft's instructions. With this you just edit an ini file, run it and then go into services and turn it on.

So, any ideas on what to use to determine that "All Users" folder or where to put it keeping in mind that I have to have access to read and write to the folder?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 15, 2010 4:16 pm

You want CommonAppData

See:
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Use this:

Code: Select all

VBSTART
    Const ssfALTSTARTUP = &H1d
    Const ssfAPPDATA = &H1a
    Const ssfBITBUCKET = &H0a
    Const ssfCOMMONALTSTARTUP = &H1e
    Const ssfCOMMONAPPDATA = &H23
    Const ssfCOMMONDESKTOPDIR = &H19
    Const ssfCOMMONFAVORITES = &H1f
    Const ssfCOMMONPROGRAMS = &H17
    Const ssfCOMMONSTARTMENU = &H16
    Const ssfCOMMONSTARTUP = &H18
    Const ssfCONTROLS = &H03
    Const ssfCOOKIES = &H21
    Const ssfDESKTOP = &H00
    Const ssfDESKTOPDIRECTORY = &H10
    Const ssfDRIVES = &H11
    Const ssfFAVORITES = &H06
    Const ssfFONTS = &H14
    Const ssfHISTORY = &H22
    Const ssfINTERNETCACHE = &H20
    Const ssfLOCALAPPDATA = &H1c
    Const ssfMYPICTURES = &H27
    Const ssfNETHOOD = &H13
    Const ssfNETWORK = &H12
    Const ssfPERSONAL = &H05
    Const ssfPRINTERS = &H04
    Const ssfPRINTHOOD = &H1b
    Const ssfPROFILE = &H28
    Const ssfPROGRAMFILES = &H26
    Const ssfPROGRAMFILESx86 = &H30
    Const ssfPROGRAMS = &H02
    Const ssfRECENT = &H08
    Const ssfSENDTO = &H09
    Const ssfSTARTMENU = &H0b
    Const ssfSTARTUP = &H07
    Const ssfSYSTEM = &H25
    Const ssfSYSTEMx86 = &H29
    Const ssfTEMPLATES = &H15
    Const ssfWINDOWS = &H24

Function GetSpecialFolder(FolderID)
  Set objShell  = CreateObject("Shell.Application")
  Set objFolder = objShell.Namespace(FolderID)
  Set objFolderItem = objFolder.Self
  GetSpecialFolder = objFolderItem.Path
End Function
VBEND

VBEval>GetSpecialFolder(ssfCOMMONAPPDATA),pathComAppData
MessageModal>pathComAppData
Simply replace ssfCOMMONAPPDATA in the VBEval line with any of the other ssf... names to get a different special folder.

This will work regardless of what language version of Windows you are using - it's hex 23 for commonappdata - and &H23 is same in German as in English ;-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts